<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
      String aaa = "aa?ddd = ?";
  
    //  String bbb = aaa.replaceFirst("?" , "f");
      String ccc = aaa.replaceFirst("\\?" , "g");
      String ddd = aaa.replaceFirst("[?]" , "h");
      String hhh = aaa.replaceFirst("[\\?]" , "k");
  
    //  System.out.println(bbb);
      System.out.println(ccc);
      System.out.println(ddd);
      System.out.println(hhh);
 %>
</body>
</html>